//http模块 :开发后台程序
//url模块
const http = require("http")
const url = require("url")
let sever = http.createServer((req, res) => {
    // console.log(req)
    if (req.method == 'GET') {
        console.log("GET的请求正在访问你")
        console.log(req.url)
        const paramsobj = url.parse(req.url, true)
        console.log(paramsobj.query.username)
    } else if (req.method == 'POST') {
        console.log("POST的请求正在访问你")
    }

    res.setHeader('Content-Type', 'text/html; charset=utf-8');
    res.end("Welcome , 冒险家 ！")
})
sever.listen(3000, () => {
    console.log("服务器已经开始工作，正在监听端口号为3000的端口")
})